package org.ysu.shoeShopping.utils;

public class Result<T>
{
    private T data;
    private int status;
    private String message;

    Result(T data, int status, String message ){
        this.data = data;
        this.status = status;
        this.message = message;
    }

    public static <T> Result<T> success(T data) {
        return new Result<>(data, 200, "success");
    }

    public static <T> Result<T> fail(String code, String msg) {
        return new Result<T>(null, Integer.parseInt(code), msg);
    }

    public T getData() {
        return data;
    }

    public int getStatus() {
        return status;
    }

    public String getMessage() {
        return message;
    }
}